Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scene.pickPosition in 2D/CV #4990

Merged
merged 8 commits into from
Feb 15, 2017
Merged

Scene.pickPosition in 2D/CV #4990

merged 8 commits into from
Feb 15, 2017

Conversation

bagnell
Copy link
Contributor

@bagnell bagnell commented Feb 10, 2017

Adds pick position support in 2D and Columbus view. Fixes #4084.

  • Tests
  • Update CHANGES.md

* @returns {Cartesian3} The cartesian position.
*
* @exception {DeveloperError} Picking from the depth buffer is not supported. Check pickPositionSupported.
* @exception {DeveloperError} 2D is not supported. An orthographic projection matrix is not invertible.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This exception is not longer valid, right?

* @exception {DeveloperError} 2D is not supported. An orthographic projection matrix is not invertible.
*/
Scene.prototype.pickPosition = function(windowPosition, result) {
Scene.prototype._pickPosition = function(windowPosition, result) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it would be more clear to name this pickPosition3D and make it @private.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or whatever a more precise name is.

@pjcozzi
Copy link
Contributor

pjcozzi commented Feb 10, 2017

Can we also document that the results can be different in 2D vs. 3D/CV due to the orthographic projection and give some sense as to how the precision works?

For example, in 3D:

image

In 2D:

image

@bagnell
Copy link
Contributor Author

bagnell commented Feb 13, 2017

@pjcozzi This is ready for another look.

@pjcozzi
Copy link
Contributor

pjcozzi commented Feb 13, 2017

Do you get this test failure?

Scene/Scene pickPosition
Expected Cartesian3({ x: -455845.5482883507, y: -5210338.458916779, z: 3637550.496413719 }) to equal epsilon Cartesian3({ x: -455845.46867895435, y: -5210337.548977215, z: 3637549.8562320103 }), 1e-7.
Error: Expected Cartesian3({ x: -455845.5482883507, y: -5210338.458916779, z: 3637550.496413719 }) to equal epsilon Cartesian3({ x: -455845.46867895435, y: -5210337.548977215, z: 3637549.8562320103 }), 1e-7.
    at stack (http://localhost:8080/ThirdParty/jasmine-2.2.0/jasmine.js:1475:17)
    at buildExpectationResult (http://localhost:8080/ThirdParty/jasmine-2.2.0/jasmine.js:1445:14)
    at Spec.expectationResultFactory (http://localhost:8080/ThirdParty/jasmine-2.2.0/jasmine.js:584:18)
    at Spec.addExpectationResult (http://localhost:8080/ThirdParty/jasmine-2.2.0/jasmine.js:332:34)
    at Expectation.addExpectationResult (http://localhost:8080/ThirdParty/jasmine-2.2.0/jasmine.js:528:21)
    at Expectation.toEqualEpsilon (http://localhost:8080/ThirdParty/jasmine-2.2.0/jasmine.js:1399:12)
    at http://localhost:8080/Specs/Scene/SceneSpec.js:660:30
    at compare (http://localhost:8080/Specs/addDefaultMatchers.js:255:29)
    at Expectation.toRenderAndCall (http://localhost:8080/ThirdParty/jasmine-2.2.0/jasmine.js:1378:35)
    at http://localhost:8080/Specs/Scene/SceneSpec.js:658:23

@bagnell
Copy link
Contributor Author

bagnell commented Feb 14, 2017

Do you get this test failure?

I was not seeing any failures. I changed the test to check the values returned instead of that it was defined. I updated the epsilon values so they should pass now.

@pjcozzi
Copy link
Contributor

pjcozzi commented Feb 15, 2017

Very nice.

@pjcozzi pjcozzi merged commit 5a7491b into master Feb 15, 2017
@pjcozzi pjcozzi deleted the pick-position branch February 15, 2017 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants